package com.weipai.springboot.module.mapper;

import com.weipai.springboot.model.Storage;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;
import java.util.Map;

/**
 * 仓库
 */
public interface StorageMapper extends Mapper<Storage>, MySqlMapper<Storage> {

    //查询品牌的详情
    Storage getStorageById(String storageId);

    //获取数据（不/包含逻辑删除的数据）
    List<Storage> selectAllByStorageDel(@Param("del") int del, @Param("search") String search,
                                        @Param("sort") String sort, @Param("way") String way);

    //批量删除
    int batchDeleteById(String[] id);

    //更改状态
    @Update("update c_storage set storage_status=#{status}, update_time=date_format(now(), '%Y-%m-%d %H:%i:%s') " +
            "where storage_id=#{id}")
    int updateStatus(@Param("id") String storagetId, @Param("status") Integer status);

    List<Map<String, Object>> listNoGoods(@Param("storageId") String storageId, @Param("start") Integer start, @Param("size") Integer size);

    int countNoGoods(@Param("storageId") String storageId);

    //根据位置定位仓储
    Map<String,Object> locateStorage(@Param("long") String longitude, @Param("lat") String latitude);

    List<Map<String,Object>> getStorage();
}